package com.example.minefieldkeepercloud.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.minefieldkeepercloud.R;


/**
 * Created by Administrator on 2017/12/25.
 */

public class SuccessDialog extends Dialog {


    private String content;

    private TextView tv_sure;
    private TextView tv_content;

    private OnSuccessListener onSuccessListener;
    public SuccessDialog(Context context, String text, OnSuccessListener onSuccessListener) {
        super(context, R.style.mydialog);
        content=text;
        this.onSuccessListener=onSuccessListener;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.dialog_success);
        setCancelable(false);
        initView();
    }

    public void initView() {
        tv_sure=findViewById(R.id.tv_sure);
        tv_content=findViewById(R.id.tv_content);
        tv_content.setText(content);
        tv_sure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //取消
                dismiss();
                onSuccessListener.getResult();
            }
        });

    }

    //点击回调
    public interface OnSuccessListener
    {
        void getResult();

    }

}
